﻿/**********************************************************************
 * @file   FITKAcousticsGroupData.h
 * @brief  声学分组数据声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-02-11
 *********************************************************************/
#ifndef _FITKACOUSTICS_GROUPDATA__H___
#define _FITKACOUSTICS_GROUPDATA__H___
 
#include "FITKAcousticsModelAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractNDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"

namespace Acoustics
{

    /**
     * @brief  声学分组数据
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2025-02-11
     */
    class FITKAcousticsModelAPI FITKAcousticsGroupData : public Core::FITKAbstractNDataObject
    {
        Q_OBJECT
    public:
        /**
         * @brief  分组数据类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        enum AcousticsGroupDataType
        {
            AcousticsNone,
            AcousticsGeometry,
            AcousticsSEASubsystem,
            AcousticsFESubsystem,
            AcousticsSensors,
            AcousticsJunction,
            AcousticsLoad,
        };
        Q_ENUM(AcousticsGroupDataType);
        /**
         * @brief  组数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-11
         */
        struct AcousticsGroupData
        {
            AcousticsGroupDataType _objType = AcousticsGroupDataType::AcousticsNone;
            int _type = -1;
            int _objID = -1;
        };
        /**
         * @brief  Construct a new FITKAcousticsGroupData object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-11
         */
        explicit FITKAcousticsGroupData();
        /**
         * @brief  Destroy the FITKAcousticsGroupData object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-11
         */
        virtual ~FITKAcousticsGroupData();
        /**
         * @brief    添加组数据
         * @param[i] data 
         * @param[i] index -1:追加 >=0:插入
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-11
         */
        void addGroupData(AcousticsGroupData data, int index = -1);
        /**
         * @brief    获取组数据数量
         * @return   int
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-11
         */
        int getDataCount();
        /**
         * @brief    获取组数据通过下标
         * @param[i] index 
         * @return   AcousticsGroupData
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-11
         */
        AcousticsGroupData getGroupDataAt(int index);
        /**
         * @brief    获取分组管理的全部数据对象ID
         * @return   QList<int>
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        QList<int> getAllObjID();
        /**
         * @brief    获取组数据对象通过下标
         * @param[i] index
         * @return   Core::FITKAbstractNDataObject*
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-11
         */
        Core::FITKAbstractNDataObject* getGroupDataObjAt(int index);
        /**
         * @brief    移除组数据
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-11
         */
        void removeGroupData();

    private:
        /**
         * @brief  组数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-11
         */
        QList<AcousticsGroupData> _dataList;
    };

    /**
     * @brief  声学分组数据管理器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-12-13
     */
    class FITKAcousticsModelAPI FITKAcousticsGroupManager : public Core::FITKAbstractDataObject,
        public Core::FITKAbstractDataManager<FITKAcousticsGroupData>
    {
    public:
        /**
         * @brief Construct a new FITKAcousticsGroupManager object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        explicit FITKAcousticsGroupManager() = default;
        /**
         * @brief Destroy the FITKAcousticsGroupManager object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-13
         */
        virtual ~FITKAcousticsGroupManager() = default;
        /**
         * @brief  从AppFrame获取对象
         * @return FITKAcousticsGroupManager*
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-11
         */
        static FITKAcousticsGroupManager* GetGroupManagerFromFrame();
    };
}


#endif
